cmake_minimum_required(VERSION 3.10)
# 项目名称
project(polarlac C)

# 设置 C 标准为 C11
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)

find_package(OpenSSL REQUIRED)

include_directories(include)
include_directories(${OPENSSL_INCLUDE_DIR})
file(GLOB SRC_FILES "src/*.c")
file(GLOB TEST_FILES "test/*.c")

add_compile_options(-O3 -Wall -DNDEBUG -march=native -mtune=native -fomit-frame-pointer)
add_executable(lac ${SRC_FILES} ${TEST_FILES})

target_link_libraries(lac OpenSSL::Crypto m)

# 删除 build 目录下内容
add_custom_target(clean-all

    COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target clean
    COMMAND rm -rf ${CMAKE_BINARY_DIR}/* ${CMAKE_BINARY_DIR}/.[!.]* ${CMAKE_BINARY_DIR}/..?*
    COMMENT "Cleaning all build artifacts and temporary files"
)